﻿using ElsProp.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ElsProp
{
    /// <summary>
    /// shuxingbianji.xaml 的交互逻辑
    /// </summary>
    public partial class shuxingbianji : Window
    {
        /// <summary>
        /// 
        /// </summary>
        public shuxingbianjiModel mode {  get; set; }
        public event Action<shuxingbianjiModel,string> DataOut;
        public string guid {  get; set; }
        public EnumZhuangBeiLan buwei { get;  set; }

        public shuxingbianji()
        {
            InitializeComponent();
            mode = this.DataContext as shuxingbianjiModel;
            this.Closing += Shuxingbianji_Closing;
            this.Loaded += Shuxingbianji_Loaded;
        }

        private void Shuxingbianji_Loaded(object sender, RoutedEventArgs e)
        {
            if (buwei==EnumZhuangBeiLan.一件套)
            {
                Button_Click(btnc,null);
            }
            else if (buwei==EnumZhuangBeiLan.左上衣||buwei==EnumZhuangBeiLan.左下衣||buwei==EnumZhuangBeiLan.左手套||buwei==EnumZhuangBeiLan.左鞋子)
            {
                Button_Click(btnc, null);
            }
            else if (buwei == EnumZhuangBeiLan.时装发型 || 
                buwei == EnumZhuangBeiLan.时装上衣 ||
                buwei == EnumZhuangBeiLan.时装下衣 || 
                buwei == EnumZhuangBeiLan.时装手套 || 
                buwei == EnumZhuangBeiLan.时装鞋子)
            {
                Button_Click(btna, null);
            }
            else
            {
                Button_Click(btnb, null);
            }
        }

        private void Shuxingbianji_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
        {
            DataOut?.Invoke(mode, guid);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            mode.suitItemName = button.Content.ToString();
        }
    }
}
